home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / dpmigcc5.zip / RSX / SOURCE / FPU-EMU / FPU_SYST.H < prev    next >
C/C++ Source or Header  |  1994-05-27  |  3KB  |  83 lines

  1. /*---------------------------------------------------------------------------+
  2.  |  fpu_system.h                                 |
  3.  |                                         |
  4.  | Copyright (C) 1992,1994                             |
  5.  |             W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
  6.  |             Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
  7.  |                                         |
  8.  +---------------------------------------------------------------------------*/
  9.  
  10. #ifndef _FPU_SYSTEM_H
  11. #define _FPU_SYSTEM_H
  12.  
  13. /* system dependent definitions */
  14.  
  15. #include <linux/sched.h>
  16. #include <linux/kernel.h>
  17. #include <sys/signal.h>
  18.  
  19. /* This sets the pointer FPU_info to point to the argument part
  20.    of the stack frame of math_emulate() */
  21. #define SETUP_DATA_AREA(arg)    FPU_info = (struct info *) &arg
  22.  
  23. #ifdef RSX
  24. struct my_task_struct {
  25.     union i387_union i387;
  26.     unsigned long _reserved;
  27. } ;
  28. extern struct my_task_struct *process_npx;
  29. #define I387            (process_npx->i387)
  30. #define FPU_info        (I387.soft.info)
  31.  
  32. #else /* NOT RSX */
  33. #define I387            (current->tss.i387)
  34. #define FPU_info        (I387.soft.info)
  35. #endif
  36.  
  37. #define FPU_CS            (*(unsigned short *) &(FPU_info->___cs))
  38. #define FPU_SS            (*(unsigned short *) &(FPU_info->___ss))
  39. #define FPU_DS            (*(unsigned short *) &(FPU_info->___ds))
  40. #define FPU_EAX         (FPU_info->___eax)
  41. #define FPU_EFLAGS        (FPU_info->___eflags)
  42. #define FPU_EIP         (FPU_info->___eip)
  43. #define FPU_ORIG_EIP        (FPU_info->___orig_eip)
  44.  
  45. #define FPU_lookahead        (I387.soft.lookahead)
  46. #define FPU_entry_eip        (I387.soft.entry_eip)
  47.  
  48. #define partial_status        (I387.soft.swd)
  49. #define control_word        (I387.soft.cwd)
  50. #define regs            (I387.soft.regs)
  51. #define top            (I387.soft.top)
  52.  
  53. #define ip_offset        (I387.soft.fip)
  54. #define cs_selector        (I387.soft.fcs)
  55. #define data_operand_offset    (I387.soft.foo)
  56. #define operand_selector    (I387.soft.fos)
  57.  
  58. #ifdef RSX
  59. #define FPU_verify_area(x,y,z)    ;
  60. #else
  61. #define FPU_verify_area(x,y,z)    if ( verify_area(x,y,z) ) \
  62.                 math_abort(FPU_info,SIGSEGV)
  63. #endif
  64.  
  65. #undef FPU_IGNORE_CODE_SEGV
  66. #ifdef FPU_IGNORE_CODE_SEGV
  67. /* verify_area() is very expensive, and causes the emulator to run
  68.    about 20% slower if applied to the code. Anyway, errors due to bad
  69.    code addresses should be much rarer than errors due to bad data
  70.    addresses. */
  71. #define FPU_code_verify_area(z)
  72. #else
  73. /* A simpler test than verify_area() can probably be done for
  74.    FPU_code_verify_area() because the only possible error is to step
  75.    past the upper boundary of a legal code area. */
  76. #define FPU_code_verify_area(z) FPU_verify_area(VERIFY_READ,(void *)FPU_EIP,z)
  77. #endif
  78.  
  79. /* ######## temporary and ugly ;-) */
  80. #define FPU_data_address    ((void *)(I387.soft.twd))
  81.  
  82. #endif
  83.